import { _decorator, Component, Node } from 'cc';
import { PinActrion } from './PinActrion';
import { HoleAction } from './HoleAction';
const { ccclass, property } = _decorator;

@ccclass('CatAction')
export class CatAction extends Component {
    
    start() {

    }

    update(deltaTime: number) {
        
    }

    putPin(pin: PinActrion):boolean {
        let ret = false;
        // 遍历所有子节点
        for (let i = 0; i < this.node.children.length; i++) {
            let child = this.node.children[i];
            if (child.getComponent(HoleAction)) {
                let holeAction = child.getComponent(HoleAction);
                ret = holeAction.putPin(pin);
                if (ret) {
                    break;
                }
            }
        }
        return ret;
    }

}


